package main

import (
	"fmt"
	"net"
	"time"
)

func main() {
	fmt.Printf("client start...\n")
	conn, err := net.Dial("tcp", "127.0.0.1:8999")
	if err != nil {
		fmt.Printf("client dail err,%s\n", err)
		return
	}

	for {
		if _, err = conn.Write([]byte("hello,zinx V0.1")); err != nil {
			fmt.Printf("client write buf err,%s\n", err)
			return
		}

		buf := make([]byte, 512)
		cnt, err := conn.Read(buf)
		if err != nil {
			fmt.Printf("client read buf err,%s\n", err)
			return
		}
		fmt.Printf("server call back:%s,cnt=%d \n", buf, cnt)
		time.Sleep(5 * time.Second)
	}

}
